package com.gwt.client.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.requestfactory.shared.RequestContext;
import com.gwt.shared.BeerProxy;

public class EditBeerEvent extends GwtEvent<EditBeerEvent.Handler> {
	public static final Type<Handler> TYPE = new Type<Handler>();

	public interface Handler extends EventHandler {
		void editBeer(BeerProxy beer, RequestContext requestContext);
	}

	private final BeerProxy beer;
	private final RequestContext requestContext;

	public EditBeerEvent(BeerProxy beer) {
		this(beer, null);
	}

	public EditBeerEvent(BeerProxy beer, RequestContext requestContext) {
		this.beer = beer;
		this.requestContext = requestContext;
	}

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<Handler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(Handler handler) {
		handler.editBeer(beer, requestContext);
	}
}
